<%@page contentType="text/html" %>
<%@page pageEncoding="UTF-8" %>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Goodwill - Выдача заказа</title>
    <link rel="stylesheet" href="resources/css/main.css"/>
    <link rel="stylesheet" href="resources/css/stylesheet.css"/>
    <link rel="stylesheet" href="resources/css/clients.css"/>
    <style type="text/css">
    </style>
    <script type="text/javascript">
        function printpage() {
            try {
                window.print();
            } catch (e) {
                alert(e);
            }
        }
    </script>
</head>
<body onload="printpage();">
<f:view>

    <h:panelGrid columns="2" cellpadding="5" cellspacing="5" style="width: 300px;">
        <h:outputText value="Номер ИС" style="font-weight:bold"/>
        <h:outputText value="#{StorekeeperOrderBean.order.id}"/>
        <h:outputText value="Счет 1С" style="font-weight:bold"/>
        <h:outputText value="#{StorekeeperOrderBean.order.c1Num}"/>
        <h:outputText value="Дата создания" style="font-weight:bold"/>
        <h:outputText value="#{StorekeeperOrderBean.order.creationDateAsString}"/>
        <h:outputText value="Менеджер" style="font-weight:bold"/>
        <h:outputText value="#{StorekeeperOrderBean.order.manager.fio}"/>
        <h:outputText value="Клиент" style="font-weight:bold"/>
        <h:outputText value="#{StorekeeperOrderBean.order.client.companyName}"/>
        <h:outputText value="Комментарий"/>
        <h:outputText value="#{StorekeeperOrderBean.order1CString}"/>
    </h:panelGrid>

    <h:panelGroup layout="block" styleClass="" style="padding:5px">
        <rich:dataTable value="#{StorekeeperOrderBean.actualOrderItems}"
                        var="orderItem"
                        rowKeyVar="row">
            <rich:column>
                <f:facet name="header">
                    <h:outputText value="№"/>
                </f:facet>
                <h:outputText value="#{row + 1}. "/>
            </rich:column>

            <rich:column>
                <f:facet name="header">
                    <h:outputText value="Код"/>
                </f:facet>
                <h:outputText value="#{orderItem.good.code}" styleClass="b"/>
            </rich:column>

            <rich:column>
                <f:facet name="header">
                    <h:outputText value="Наименование"/>
                </f:facet>
                <h:outputText value="#{orderItem.good.name}" styleClass="b"/>
            </rich:column>

            <rich:column>
                <f:facet name="header">
                    <h:outputText value="Количество" style="font-weight:bold"/>
                </f:facet>
                <h:outputText value="#{orderItem.count} шт." rendered="#{StorekeeperOrderBean.isBuildMode}"/>
                <h:outputText value="#{orderItem.factGivenFromStore} шт." rendered="#{StorekeeperOrderBean.isOutMode}"/>
            </rich:column>

            <rich:column>
                <f:facet name="header">
                    <h:outputText value="Кол-во в гр. таре"/>
                </f:facet>
                <h:outputText value="#{orderItem.good.packageCount}"/>
            </rich:column>

            <rich:column>
                <f:facet name="header">
                    <h:outputText value="№ Гр. тары"/>
                </f:facet>
                <h:outputText value="#{orderItem.packageNumber}"/>
            </rich:column>

            <rich:column style="border-left-style:dashed;text-align: right">
                <f:facet name="header">
                    <h:outputText value="Свободный остаток" style="font-weight:bold"/>
                </f:facet>
                <h:outputText value="#{orderItem.good.count} шт."/>
            </rich:column>
        </rich:dataTable>
    </h:panelGroup>
    <h:panelGrid columns="2" cellpadding="5" cellspacing="5" style="width: 300px;">
        <h:outputText value="Итого по заказу:" style="font-weight:bold"/>
        <h:outputText value="#{StorekeeperOrderBean.orderPrice} р."/>
    </h:panelGrid>
</f:view>
</body>
</html>